package com.googlecode.ozonbooksfinder.matefinder.actions
{
	import com.asfusion.mate.actionLists.IScope;
	import com.asfusion.mate.actions.AbstractAction;
	import com.asfusion.mate.actions.IAction;
	import com.asfusion.mate.core.ISmartObject;
	import com.googlecode.ozonbooksfinder.matefinder.view.AboutView;
	
	import flash.display.DisplayObject;
	
	import mx.containers.TitleWindow;
	import mx.managers.PopUpManager;

	public class AboutAction extends AbstractAction implements IAction
	{
		private var _parent:Object;
		public function get parent():Object
		{
			return _parent;
		}
		public function set parent(value:Object):void
		{
			_parent = value;
		}
		
		
		override protected function run(scope:IScope):void
		{
			super.run(scope);

			var realParent:DisplayObject;
			if(parent is ISmartObject)
			{
				realParent = 
					DisplayObject (ISmartObject(parent).getValue(scope));
			}
			else
			{
				realParent = DisplayObject (parent);
			}

			var window:TitleWindow = 
				TitleWindow (PopUpManager.createPopUp(realParent, AboutView, true));
			PopUpManager.centerPopUp(window);
		}
	}
}